<template>
  <div>
    <router-view />
    <div id="drag" @touchmove="drag">
      <img src="./assets/theme-img/icon_person_mail.png" alt />
    </div>
  </div>
</template>
<script>
import { reactive, toRefs } from "vue";
export default {
  setup(props) {
    const drag = e => {
      e.preventDefault();
      let x = e.touches[0].clientX;
      let y = e.touches[0].clientY;
      let div = document.getElementById("drag");
      if (
        (x > 50 && x < document.body.clientWidth-25) &&
        (y > 50 && y < document.body.clientHeight-50)
      ) {
        div.style.top = y-50 + "px";
        div.style.left = x-50 + "px";
      }
    };
    return { drag };
  }
};
</script>
<style lang="scss">
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
#app,
body,
html {
  width: 100%;
  height: 100%;
}
#drag {
  width: 80px;
  height: 80px;
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: #007aff;
  border-radius: 50%;
  text-align: center;
  line-height: 90px;
  img {
    width: 30px;
    height: 30px;
  }
}
</style>
